Hello,
I'm working on my first automation project using Node-RED, and I need assistance in creating a flow that controls my lights based on motion detection. Before I proceed, let me address the guidelines:
-
Research: Yes, I have done some research on Node-RED basics of motion sensor integration but I was unable to find or understand the solutions given.
-
Explanation of Attempts: I've attempted to create a basic flow, but I'm stuck on the logic for handling the timers and restarting them when motion is detected. Some people wrote that using a stoptimer node is what I'm looking for, but I'm not understanding how to implement them, so they achieve this automation.
-
Platform and Version: I'm using Node-RED version 14.5.0 as an Addon to Home Assistant OS.
Let me explain my project in detail:
I want to create a Node-RED flow that accomplishes the following:
- When motion is detected
- turn on the scene that turns on light.
- If no motion is detected for 90 seconds, dim the lights.
3.1. If however motion is detected within these 90 seconds, reset the timer from step 3. - If no motion is detected for an additional 30 seconds after dimming, turn off the lights.
4.1 If however motion is detected during these 30 seconds, undim the lights and start over from step 2.
For a more visual explanation, look at the screenshot provided.
I know, the "no motion" current state notes are wrong. They only act to visualize the flow, I want to accomplish.
I've already set up my motion sensor and lights in Node-RED, but I'm struggling with how to create the logic to handle the timers and motion detection events.
Question: Could you please help me design the Node-RED flow that accomplishes this motion-activated lighting control scenario? I'm specifically looking for guidance on how to structure the flow, use timers effectively, and trigger events based on motion detection.
Additionally, if there are any specific Node-RED nodes or plugins that would be useful for this project, please let me know.
Thank you for your assistance.