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.

  • @[email protected]
    link
    fedilink
    English
    410 months ago

    It’s also important to set the mode of the automation to “restart”, then it works flawlessly

    • SolidGrue
      link
      English
      210 months ago

      Aha! THAT’S what that does. Thank YOU too!

      • @[email protected]
        link
        fedilink
        English
        210 months ago

        I don’t want to set a misunderstanding: this does not solve the state on reboot issue, maybe “flawlessly” is not the correct word. On a reboot, all automations are always stopped, so that does not help here.

        • SolidGrue
          link
          English
          110 months ago

          No, no. I do sometimes have to contend with race conditions and reentrant triggers. I never considered looking into whether it was possible to change the execution mode, even if I did read that documentation without understanding what it meant.

          Thanks for the pointer back to it. Now I grok it.