The gate is working fine in the dashboard and have a Basic Rule that
When Time of Day is 60 minutes after sunset ...
Turn on West Gate
Wait until Time of Day is sunrise, then ...
Turn on West Gate
Having trouble with this RM.
Given your explanation above, that looks like it should work -- mostly. There may be problems if the rule re-enters before that 4-minute delay is up because nothing cancels that. I normally suggest using "Wait for event: elapsed time" instead of "Delay" to make that easier, but you can also mark the delay as "cancelable?" and add a "Cancel Delayed Actions" action to the beginning of the rule.
I'm not saying that explains your problem, but it might be one possible outcome in your case. If you have additional problems, I would:
enable all logging on the rule and see what Logs say if it doesn't work as you expect, which should tell you what is happening when (ideally, filter to your rule when viewing)
make sure you do not hit Done or Update Rule while the wait/delay is in progress, as these steps "re-initialize" the rule and will cancel things like that (just viewing the rule is fine)
Isn't the rule just setting up a loop?
On triggers the rule, delay 4 minutes, then On
which triggers the rule, delay 4 minutes, then On
which triggers the rule...
There is a contact sensor in the required expression, which I assumed is supposed to correspond with this same device. If that is correct, then it should prevent this. If not, or if that device doesn't support accurately for some reason, then it certainly could be an issue.
Agree, over complicating, that's why I'm here.
Two rules are the solution. The 1st one is working fine overnight. It's the day time rule where the gate is closed to open and have it close after someone enters.
The overnight rule doesn't run if the gate is already closed.
That looks correct, and there's no reason it should have stalled at the wait. I'm assuming you waited at least 4 minutes? Also, you didn't open the rule and hit Done or Update Rule or do anything else that might have cancelled a timer?
Also, thinking of this more: does the gate always close automatically or might you manually close it before the 4 minutes are up? If the latter is the case, you'll need to add something else to make sure it doesn't actually open via that "on" command when it's already closed (but that would not be causing this particular issue).
Here is the log. The gate is closed while the last entry on the log is 'Action: Wait for event: --> elapsed time: 0:04:00'
Also looks like the rule in in a loop?
No manual closing, might think about disabling until the time is up.