esphome:
  name: test-delay-action

host:
api:
  actions:
    - action: start_delay_then_restart
      then:
        - logger.log: "Starting first script execution"
        - script.execute: test_delay_script
        - delay: 250ms  # Give first script time to start delay
        - logger.log: "Restarting script (should cancel first delay)"
        - script.execute: test_delay_script

logger:
  level: DEBUG

script:
  - id: test_delay_script
    mode: restart
    then:
      - logger.log: "Script started, beginning delay"
      - delay: 500ms  # Long enough that it won't complete before restart
      - logger.log: "Delay completed successfully"
