One-Button Control for Shutter Animation and Physical Device

I have a sequence of 17 images (from shutter_01.png to shutter_17.png) that visually represent the gradual opening of a shutter.

Additionally, I have a SUPLA shutter device integrated into Home Assistant, which physically opens and closes the shutter.

My goal is:

  • When I press a button:
    • The shutter animation should immediately begin, playing the image sequence from 1 to 17.
    • At the same time, the SUPLA shutter device should start opening via cover.open_cover.
  • When I press the button again:
    • The animation should stop immediately.
    • The SUPLA shutter device should stop moving via cover.stop_cover.

In short, I want the visual animation and the physical shutter operation to start and stop in perfect sync using a single toggle button.