LED flashing

Hello to all .Hi I need to flash a led.
I created this script:

lampeggio:
  alias: lampeggio
  sequence:
  - service: switch.turn_on
    data: {}
    entity_id: switch.ledtt
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 500
  - service: switch.turn_off
    data: {}
    entity_id: switch.ledtt

This way I only have one flash.
Now I thought about creating a second script that repeats the blinking until a certain condition is true

ripetere:
  alias:  ripetere lampeggio
  sequence:
  - repeat:
      while:
      - condition: state
        entity_id: switch.led_goccia
        state: 'on'
      sequence:
      - service: script.lampeggio

Unfortunately nothing happens.

Could you create a Light from your switch and the use the FLASH option in LIGHT ?

Hi … the led to blink is configured as swicth in esphome

You can use the output esphome and create a light from that.

Can you share you esphome config ?

Try changing to mode: restart or maybe queue