Mastering Automation with Conditional Logic

Hey everyone, I wanted to share my recent journey in setting up a smart home automation that I’ve been working on. It’s been a bit of a challenge, but also super rewarding once I got it sorted out!So, the goal was to create an automation that turns on two different lights an hour before sunset. Pretty straightforward, right? But here’s the twist: one of the lights shouldn’t turn on if it’s after 8 PM. At first glance, it seemed simple, but I quickly realized it wasn’t as straightforward as I thought.I started by setting up the basic automation using the sunset sensor. It worked perfectly for turning on both lights an hour before sunset. But then, when I tried adding the condition for the later light to only turn on before 8 PM, things got a bit messy. The logic just wasn’t flowing as I expected it to.After some trial and error, I decided to break it down step by step. I looked into using time conditions alongside the existing sunset trigger. It took a bit of tweaking, but eventually, I figured out how to structure the conditions so that each light had its own set of rules. The key was realizing that I needed to separate the conditions for each entity rather than trying to apply them all at once.Now, everything works seamlessly! The lights come on at the perfect time, and the later light respects the 8 PM cutoff. It’s such a neat setup, especially during the winter months when the sun sets earlier. I love how this automation enhances my evening routine without any hassle.If anyone else is working on similar automations, I’d be happy to share more details or tips. Let me know if you have any questions or if you’ve tackled something similar yourselves!