Easy Flashlight/Torch Toggle easily using tasker I want to turn on the torch on the device by pressing the power button 3 times(or something convenient) and display a notification saying "Flashlight ON" and turn it off by simply swiping out(clearing) the notification.

I have achieved this by creating 2 macros in Macrodroid.

But I wanted to do the same exact thing with Tasker because obviously tasker can do a lot of things whereas macrodroid is limited to only a set of things and its not worth using both of them at the same time.
Here is a workaround you could use.

Create a Task to toggle torch ( alternatively get a TeslaLED plugin -it supports a lot of devices). 

I am not sure if this is my device limitation but the Hardware state is only limited to media button and not power button but nevertheless I believe the outcome will be the same.

Profile
State >> Hardware >> Media button (Check both held down and stop event)

Tasks

Task 1 (entrance) You can name it TorchlightCtrl or anything.


A1 Alert >> Torch
A2 Alert >> Flash (text: "Flashlight ON" Enabled Long: On) 
A3 Alert >> Notify (e.g Torchlight Enabled)


Save and exit this Task

Create another task

Task 2 (exit) 


A1: Alert >> Notify Cancel (title: Torchlight Enabled)
Press back to exit
A2 Task >> Stop (Put the task created earlier -in this case TorchlightCtrl) 


Explanation: Pressing the media button will trigger Task 1 (TorchlightCtrl) to flash the torch, and a persistent notification is displayed in the notification bar. 
Dismissing the notification will trigger Task 2 which stops Task 1, additionally turning off the trigger.

Unfortunately my device Camera light is not working so could not expiclitly test it, please give me feedback if it works or not, so I can further improve it. Cheers