ESPHome update_interval performs interval before lambda function

I’m new to ESPHome, and have to say thus far it has been great experience, quick and easy setup with simple interfacing to hassio; however I’m now facing and issue which I do not know how to resolve.
I have the below code which is configured to control a smart light strip, with a specific lambda function, where I want a change delayed every 6min.

  • platform: fastled_clockless
    id: top
    chipset: WS2813
    pin: GPIO0
    num_leds: 40
    rgb_order: BRG
    name: “ShelfTop”
    • addressable_lambda:
      name: “Self Test Effect”
      update_interval: 360s
      lambda: |-
      ESP_LOGD(“statustest”, “code starts here”);

However when I first send through the command to run the particular effect, it is delay for 6min (or what ever I set the ‘update_interval’ to). I want the effect to start starlight away, and then re-run every 6min. Is there a known way to perform this function?

After some time, and a little more learning, I found that you can declare and use static variables in the lambda function that keep over each iteration.
As such my code now runs well following example:

         name: "Shelf Segments"
         update_interval: 500ms
         lambda: |-
          static int last_update;
          int update_time = 50; //how quickly to update in sseconds
          int red; int blue; int green;
          if((last_update + (update_time * 1000)) < millis()){
             <your code goes here>