Trigger & Conditions Confirmation

I’ve been reading up on triggers and wanting to know what is the best practice to use in automations. I’m going to use a basic example to explain.

As a trigger I have one on/off switch.
The automation triggers in the on position.
The condition is in between time 6pm-8pm
Action switch on a light.

This works as expected if the condition time is already in between 6pm-8pm.
However if the switch is on and the time is not in between 6pm-8pm then it wont work unless the switch is re-toggled in between 6pm-8pm for it to work.

The trigger is working as it should (I know) but how do you get around these situations?
I can probably get it to work if I automate a re-toggling of the switch and stop it once the automation ends but i’m sure this is not the most effective way to do something this simple.
I tried to set the condition as a trigger but within the gui I could not see how to input in between times.
I was hoping that once triggered it waits until the conditions are met for it to complete its automation.

What do you guys do in this situation? hoping I have provided enough info.

Thanks in advance.

Hi, I think 2 triggers with 2 conditions would work:
T1: entity state from off to on
T2: 6pm
C1: entity = on
C2: time between 6 and 8pm

Hi Rick,

Thanks for your responses, i will work my way through it. I see the problem lies when you introduce conditions. So your automation should be focused on your conditions being met before your trigger to get your desired outcome? Its a pity multiple triggers are an “or” logic instead of “and” logic which may simplifier the flow. Alternatively in my example i could just keep polling my trigger between 6pm and 8pm until my conditions are met and then stop the polling at the end of my automation. Seems to be counterproductive. Maybe im over thinking it.

You are. Do what @rekenaar suggested with two triggers and matching conditions.

Triggers when the switch goes on and also at 6pm to catch the case where the switch is already on at that time — checks switch and timespan are both good before proceeding.

Triggers are an instantaneous event — there’s no concept of AND.

Thanks Troon, yes looking at @rekenaar logic will work.
Appreciate everyones help.