Check automation every 5mins or so

I have implemented light brightness automation in esphome, but sometimes esp32 is restarted for any reason light doesn’t turn on. How can I implement a check that ensures the light is turned on at the given brightness set in the automation at that time?
I usually have to turn on the light, as shown in the graph, manually, which defeats the purpose of the automation.

#Automation for the Neopixel light    
    on_time:
      # Every morning everyday at 7am
      - seconds: 0
        minutes: 0
        hours: 7
        then:
          - light.turn_on: 
              id: AqauriumLight
              brightness: 20%
      # Every morning everyday at 9am brightness increased to 50%
      - seconds: 0
        minutes: 0
        hours: 9
        then:
          - light.turn_on: 
              id: AqauriumLight
              brightness: 50%
      # Every morning everyday at 10am brightness increased to 75%
      - seconds: 0
        minutes: 0
        hours: 10
        then:
          - light.turn_on: 
              id: AqauriumLight
              brightness: 75%         
      # Every morning everyday at 11am brightness increased to 100%
      - seconds: 0
        minutes: 0
        hours: 11
        then:
          - light.turn_on: 
              id: AqauriumLight
              brightness: 100%
      # Every evening everyday at 5pm brightness decreased to 50%
      - seconds: 0
        minutes: 0
        hours: 17
        then:
          - light.turn_on: 
              id: AqauriumLight
              brightness: 50%
      # Every evening everyday at 7pm light turn.off
      - seconds: 0
        minutes: 0
        hours: 19
        then:
          - light.turn_off: 
              id: AqauriumLight          

I think if you drop the seconds and minutes it will “keep trying” for the whole hour.

    on_time:
      # Every morning everyday from 7 until 8....
      - hours: 7
        then:
          - light.turn_on: 
              id: AqauriumLight
              brightness: 20%

Otherwise you could set up an interval with some time conditions within a lambda condition?

I went with restore_mode: RESTORE_DEFAULT_ON method. Before marking this as a solution, I will test it for 2-3 days.

 - platform: monochromatic
    name: "10Gal Aquarium Light"
    output: gpio_19
    id: AqauriumLight
    restore_mode: RESTORE_DEFAULT_ON

as discussed here

It is holding so far.

1 Like

Marked as solved and tested for more than three days.