Can I test in ui while loop if calendar event is active?

Another automation with long delay. :disappointed:
Anyway there is a good macro you can use to get the cheapest hours. Cheapest Energy Hours - Jinja macro for dynamic energy prices