Pyscript: Event Detection?

Im using an @event_trigger to turn the lights on and off with the Lutron Pico remote. Workes perfectly as intended.

Is there a way to detect an event from within the task? Or can that only be done with an @event_trigger?

What I’m looking to do is initiate a loop that starts dimming the lights on the button-press, then stop in the button-release.

Found a solution I hadn’t thought of!

task.unique(device_name)