Hey everyone! I wanted to share my recent experience setting up a smart lighting system in my kitchen using Home Assistant. It’s been a fantastic journey, and I thought I’d walk through the process and challenges I faced along the way. Hopefully, this will help others who are looking to achieve similar automation in their homes.First, let me give you a bit of context. I have a motion sensor and a smart wall switch controlling the kitchen lights. My goal was to create an automation where the lights turn on when motion is detected, stay on for 5 minutes, and then automatically turn off if no further motion is detected. However, if motion is detected within those 5 minutes, the timer should restart, keeping the lights on for another 5 minutes. Sounds simple enough, right? Well, it turned out to be a bit more complex than I initially thought.I started by setting up the motion sensor and the smart switch. Both devices were easy to install and integrate into my Home Assistant setup. The real challenge came when configuring the automation rules. I spent hours tweaking the settings, trying different combinations of delays and conditions, but nothing seemed to work quite right. The lights would either turn off too early or not restart the timer when motion was detected again.After some research and trial and error, I finally found a solution that worked perfectly. I used a combination of state variables and timers within Home Assistant’s automation editor. Here’s a quick breakdown of what I did:1. Motion Detection Trigger: I set up the automation to trigger whenever the motion sensor detects movement.2. Turn On Lights: When motion is detected, the kitchen lights are turned on immediately.3. Set Timer: A timer is set for 5 minutes. If no further motion is detected within this time, the lights will automatically turn off.4. Reset Timer on Motion: If motion is detected again before the timer expires, the timer is reset, ensuring the lights stay on for another 5 minutes.This setup has been working flawlessly for the past week. It’s incredibly convenient, especially when I’m cooking or cleaning and don’t want to constantly fiddle with light switches. The lights now adapt to my movements seamlessly, creating a more comfortable and efficient kitchen environment.I’d love to hear how others have tackled similar automation projects. Do you have any tips or alternative approaches that might be even more effective? I’m always looking for ways to improve my smart home setup, so your insights would be greatly appreciated!Happy automating everyone! ![]()