I have installed a camera which is capable of motion detection, once motion is detected there is an automation that can turn on a light connected to Tasmota flashed motherboard. The automation also turns lights off after 30 seconds.
For now I have set the automation mode to “single” and it seems to be working but I am little confused if I should use “single” or “restart” modes for automation in the event that motion detected goes longer than 30 seconds.
As next improvement, I intend to turn on video recording to NAS feature so pretty sure that automation modes “queued” and “parallel” are not relevant to my use case.
Please share if there are any pros and cons of using “single” and “restart” in my use case.
It depends on how you’ve written your automation. If it has a delay: in the action to turn the light off, for instance, then you’d want mode: restart to make sure that movement restarts that timer. Otherwise, the motion sensor turning on again during the delay won’t prevent the automation from turning the light off.
I prefer to write that sort of automation with 2 triggers, one for when the motion sensor turns on and another for when it’s been off for some period of time. mode: single works fine for that style.
If one automation is turning the light on and off, I suggest you use restart. When triggered a second time, the first instance of the automation’s action (which is performing its 30-second countdown) will be cancelled and restarted. The light will remain on as long as there is motion.
@rccoleman & @123 thanks, I’m running it as a single automation with delay before turning off light so your explanations make perfect sense
However I am running into another issue on first day of testing, the event of light switch off changes enough pixels and camera software thinks triggers the automation all over again so the light once triggered seems to get stuck in an infinite do loop of on and turning off sequences
Install a PIR that won’t be affected by a light turned on or off. Pros and cons…
Let the light’s timer run out. During the on period, have the automation that turned the light on upon motion turn itself off and turn it back on when the light turns off. Multiple automations, etc. This will create gaps in lighting in case of continuous movement.
A check that there was movement for a small period and only then turn on the light. In other words, filter the “glitch” when the picture changes from light to dark. Now, there is a for: that can be used in triggers but that typically works where the entity or sensor has been in some state for a continuous period. Since motion detection is kind of momentary (it’s really detecting changes) I can’t think how to make this work, but maybe it triggers more thoughts.
More advanced image processing to check if the image went dark(-ish) (likely to be error prone) or to detect objects and/or faces (which may not be feasible if it’s too dark to begin with).
So I guess it also depends on the use case: is the light turned on for convenience while moving around, or as a deterrent and to capture motion snapshots or videos?
@parautenbach This is an experimental set up and I was going to set up cameras with lights few places around the house. At one place the light activation is just for convenience of walking like staircase light but other places it also has security implications like front porch where video recording may be needed.
I think adding a PIR would simplify the set up and I may need to re-think the details.
I ended up hooking a combo sensor made out of HC-SR501 and RCWL-0516 sensors and the automation works great with motion detection with very occasional false positives!!