Philips Hue Event Slowdown

I’m trying to create an pyscript integration between a Shelly 2PM and a Philips Hue to be able to control the light using a switch connected to the Shelly (see my previous post).

The integration works as follows (simplified):

while(button_pressed):
  light.turn_on("test.hue.bulb, brightness=(old_brightness + brightness_step), transition=transition_sec)
  task.sleep(transition_sec)

However it seems the events are getting throttled, as much of the transitions occur after I’ve released the switch (especially is the transition_sec set to 0.2). Is there any way around this or is this likely not possible with hue bulbs?