I’ve been working on setting up my smart home to automatically control my lights when I’m away, and I wanted to share my experience in case anyone else is tackling a similar project. My goal was to have my living room lights turn on at sunset and then shut off around 10:30 PM, but with a bit of random timing to make it look more natural. I thought using PLEG would be the way to go, but I ran into a few hiccups along the way. After some trial and error, I realized the issue was with how the automation was triggered. I initially set it up to rely solely on the sunset schedule, but I found that the random timing feature wasn’t working as expected. To fix this, I ended up creating two separate automations: one for turning the lights on at sunset with a random delay and another for turning them off at 10:30 PM, also with a slight random delay. This approach gave me the natural-looking pattern I was aiming for without the earlier inconsistencies. If anyone else is working on something similar, here are a few tips that might help: - Test each part separately: Before combining everything into one automation, test each trigger and action individually to ensure they’re working as intended. - Use random delays wisely: Adding a small random delay (like 5-10 minutes) can make the automation feel more organic, but don’t overdo it or it might cause unexpected behavior. - Log and monitor: Keep an eye on your system logs to spot any errors or issues early on. I’d love to hear how others have tackled similar projects or if there are more efficient ways to achieve this kind of automation. Happy automating! ![]()