Combining automations

I have successfully created a timer which automatically turns my light off after being switch on for a set period of time but I am looking to integrate it with location and time of day.

What I want is after sunset for the light to trigger when I approach home (presumably using my phone’s location) so that it links to my current automation of staying switched on for say 5 minutes before turning off on its own (using the existing automation).

In daylight hours I don’t want anything to happen. I also don’t want it triggering whilst I’m already home, only when I arrive home. Is any of this possible? I don’t currently have a hub. The light is on a tp link smart plug.

Many thanks.

I’ve come up with a possible solution which I’ve been unable to test but perhaps someone has a view on the following…?

A virtual switch which activates at sunset (and deactivated at sunrise)

Then a second virtual switch which activates when someone comes home (using their phone) but crucially ONLY if the first switch is on (i.e. after sunset)

The second virtual switch activates the timer which turns the light on for 5 minutes before automatically turning off.

Kind of works in my head but maybe I’ve either missed something or made it more complicated than necessary?