Trigger Event at Time and After Time

Can someone help me out here…

I’m looking to toggle a switch at sunset and turn them off at 00:30:00. However, if I reboot HA, power goes out, etc. between those times, I want the lights to cut on if they are off.

How would one set that up?

Thanks!

Do you have a sensor that can detect if your power has cut off or returned?

Is your Home Assistant host on a UPS?

Yes, it’s on a UPS. Unlikely it will go out, but more likely that the Insteon (which relies on cloud) will go out. Another reason to transition everything to Z-wave.

Ok good. We won’t use a home assistant start trigger with a time condition then.

Do you have the UPS connected to Home Assistant so you can see if the power has gone out / returned?

If not, can you connect it via USB or Ethernet?

The NUT addon and integration will enable you to tell when your power has gone out or returned, so we can trigger on that. Then check the time window. Then perform the actions if needed.

Unfortunately, not the one where the HA is connected. However, my network cabinet in the basement has 2 APC UPS with ethernet connectivity. I have SNMP running.

The other thing I was hoping to be able to trigger this is if the cable modem, network switches, router, etc. happened to be out, rebooted, upgraded, etc. during that time. I would like for them to turn on/off if past that time.

However, none of this is really critical. It’s outdoors Christmas lights (turning on/off the lights, turning on/off the landscape lights after the Christmas lights are off).

The way I would approach this is with three automations.

  1. triggered at sunset, turns the lights on.
  2. triggered at 00:30, turns the lights off.
  3. triggered by power turning on. Conditions that check if the lights are off and if it is between sunset and 0:30. If all that is true then turn the lights on.