Automation + partial power outage - is there a way to make HA monitor/check automation items to re-execute?

Apologies if this has been answered previously, I possibly was using wrong search terms when looking for previous references.

What I’m trying to do is the following -

Automation script to turn on some lights via (shelly1) during hours 18:00:00 and 22:00:00

This works fine, however isn’t failover proof, during my testing I killed the power to the lights at 17:50 and turned the power back on at 18:05:00 to see if HA would be running its automation and realise "oh shelly1 is off , automation script says the light shoudl be on -> execute and turn lights on

This doesn’t happen, so it seems HA will poll its automation items once at the scheduled time condition and not again until the following day.

Background :: All of my computer/network devices are connected to a series of UPS, but I do not have the entire house on backup power.

Is there a way in HA to modify the automation to check every 5mins and then execute?
Or is there a global HA setting on the frequency of automation events?

From a sysadmin point of view, if this was a cron job on a server, I’d have another cron job that acted like a watchdog which would run every 5mins (*/5) which would basically execute the automation script, not ideal but would work.

This also raises the question, if the house / UPS all had a complete power fail (power was off long enough where UPS shutdown) upon startup, are there additional conditions/triggers for automation that should be included to make HA check if an automation should be run?

Thanks in advance everyone, loving the community here and hopefully the answer is staring me in the face and I’ve just missed it.

automation:
  trigger:
    platform: time
    at: 
      - '18:00:00'
      - '22:00:00' 
  action:
    - wait_template: "{{ not is_state('light.shelly', 'unavailable') }}"
    - service: "light.turn_{{ 'on' if now().hour in [18, 19, 20, 21] else 'off' }}"
      entity_id: light.shelly
1 Like

thanks for the reply! I was just messing with some time parameters and found another way which seems to satisfy the requirement as well -

- id: '1609465xxxxx'
  alias: Test Office Lights
  description: ''
  trigger:
  - platform: time_pattern
    minutes: /5
  condition:
  - condition: time
    after: '13:25'
    before: '14:00'
  action:
  - type: turn_on
    device_id: 44ee8xxxx5a56ff1436xxxxx
    entity_id: switch.shelly1_xxxx
    domain: switch
  mode: single
  max: 10

Of course with this method, I’ll need another automation to turn them off. I don’t feel my method is a clean solution though.