(Noob..) Repeat action due to smart plug goes to sleep?

I try to switch on my boiler during the 4 cheapest hours with a smart plug. The smart plug seems to go to sleep, and often misses the turn-on message. Else the binary sensor for turning on seems to work. I will try to send the turn-on message a few times to the smart plug to make sure it wakes up and turns the boiler on. I have found a few examples of using repeat and repeat.index in the automation to do something similar, but I`m still not sure exactly how to do this. The code without repeat look like this:

- id: 'xxxxxxxxxxx'
  alias: Bereder på
  description: Slå på bereder innenfor de 4 billigste timer
  - platform: state
    - binary_sensor.billigste_4_timer
    from: 'off'
    to: 'on'
  condition: []
  - type: turn_on
    device_id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    entity_id: switch.bereder_kjeller_socket_1
    domain: switch
  mode: single

I guess something like

- repeat:
      until: "{{repeat.index == 3}}"

and a delay some where?

description: <your desc>
... some other stuff...
  - repeat:
      count: "16"
        - service: switch.turn_on
          data: {}
            entity_id: switch.boilah
        - delay:
            hours: 0
            minutes: 0
            seconds: 5
            milliseconds: 0

That repeats the “turn on + sleep 5s” action 16 times.

Best of luck!

Excellent, Thanks :grinning: