I have a bunch of presence and motion sensors (like four, but shush) and when people leave rooms I would like to turn the lights off after five minutes, however if someone returns to the room before that five minutes is up, I’d like to start that countdown again. Is there a grateful way to do this that isn’t me just doing if no activity for five minutes, turn off the lights, else wait five minutes and then turn off the lights. Because that’s ugly, rigid and not very smart at all.

  • TedZanzibar@feddit.uk
    link
    fedilink
    English
    arrow-up
    2
    ·
    11 months ago

    I have something like this setup for my porch lights. Light goes on when it detects motion, then it uses wait_for_trigger to wait until the motion stops before starting a 20 second and turning off the lights.

    All simple enough so far but, crucially, the “mode” for the automation is set to restart. That way if the sensor detects motion during the 20 second countdown it cancels the whole run and starts again from the top.