How do I add a cool down to an automation? - eviltoast

I have an automation that turns my driveway lights on when motion is detected. It normally works fairly well but it was windy last night and that caused the automation to trip endlessly as my trees and bushes were whipping around. Lights would come on, shut off 10 minutes later, then turn right back on again. It basically did this all night until I disabled the automation.

I’ll do some fine tuning of the motion sensors which will help and I’m considering adding a condition to the automation where it won’t trip if the wind speed is above a certain level but how can I add some kind of cool down timer to the automation to prevent it from endlessly engaging?

  • 👍Maximum Derek👍@discuss.tchncs.de
    link
    fedilink
    English
    arrow-up
    9
    ·
    edit-2
    1 year ago

    There may be a more straight forward way to do it now, but the traditional way is to add a condition to the automation based on the automation’s (or maybe the light or motion detector) last_triggered property. You need, AFAIK, to use a template for this.

    A condition with something like this should make it so it can’t fire more than once every hour (60 seconds times 60 minutes): {{ (as_timestamp(now()) - as_timestamp(state_attr('automation.driveway','last_triggered'))) > 60 * 60 }}