Automation with 2 time conditions

Hi,
I’m fairly new to Home Assitant, and I recently created a couple of automations.

I noticed that when using the GUI (in Configuration/Automations), if you add 2 conditions of Time, the translation in the GUI doesn’t work: you end up having the synthax wrong because the 2 conditions are just one after the other, with the condition type (“OR”, in my case) in the middle. No matter how I tried to turn it around in the GUI, it never worked.

After some research in the forums, I saw a code with similar features, that I adapted to my needs.
When 2 similar conditions are to be used, it’s my understanding that the synthax has to indicate the condition type at the beginning, followed by the conditions, like this (sorry for the formatting, I’m new to writing comments):
'condition:
’ condition: or
’ conditions:
’ - condition: time
’ after: ‘5:50:00’
’ before: ‘9:10:00’
’ - condition: time
’ after: ‘15:50:00’
’ before: ‘20:10:00’

Then again, trying to integrate that code directly in the GUI made it go mad, and the GUI never accepted to have it saved, because it detected some sort of coding error.

That’s why I went directly in the automation.yaml to code it. After that, it has worked no problem.

Just thought sharing could be useful to others.

On including code: You can use either the preformatted text </> option at the top of the entry window or you can bracket the code with three backward single quotes (usually on the tilde key) on the lines before and after the code.