Garage Door Automation with Sunset Schedule

Hey everyone, I’m trying to set up an automation for my garage door and front porch light, and I could use some help figuring it out. Here’s what I want to achieve:

  1. When my garage door opens, I want the front porch light to turn on.
  2. The light should turn off two minutes after the garage door closes.
  3. Additionally, the porch light should come on automatically every night one hour before sunset and stay on until one hour after sunset, giving a total of two hours of light.

The tricky part is making sure that if the garage door closes while the porch light is already on at sunset, the light doesn’t turn off after just two minutes. I want the light to remain on until one hour after sunset regardless of the garage door’s state during that time.

I’m thinking of using a combination of time-based triggers and state conditions. Maybe I can create a scene that prioritizes the sunset schedule over the garage door automation during those specific hours. Does anyone have experience with setting up something like this? Any tips or examples would be greatly appreciated!

I’m also considering whether to use built-in automation tools or if I need a more advanced setup with custom scripts. I’m a bit new to this, so any guidance would be really helpful. Thanks in advance for your suggestions!