I am new to Home Assistant. so I apologize in advance for asking a question that may have already been answered.
I have a motion sensor connected through an ESP32 configured as an MQTT binary_switch. I have an automation setup that sends a text to my phone whenever the motion sensor is triggered, but I am looking for some way to configure a hold down timer on the binary_switch or the automation so I don’t get 100 text messages over a minute whenever the dog chases a squirrel in the back yard. Just one alert in 5 minutes is enough.
Is it possible to store the time in a variable when a binary sensor is triggered and then compare the current time with the stored time + X minutes the next time the sensor is triggered?
Is there a way to configure the automation to set a timer or store the current time in a variable so it can be compared the next time the sensor is triggered? Once the motion sensor has been triggered and an action is performed, additional motion sensor triggers should not take any actions for X minutes.
The other question is, is there any way to configure a button card that toggles the value of a variable that can also be set to mute notifications? For example, is it possible to set a variable as true or false that can be used in a condition?
That should be a binary_sensor, not switch. You change switch states. Binary sensor states are changed by some process (e.g. movement detected).
There are a few ways to do this. The simplest is to make sure the automation is running in single mode (it is the default mode) and add a short delay at the end of the actions.
Another way is to use a condition that checks how long ago the automation was last triggered.
Yes. Use an input boolean helper. Call it something like “Mute Notifications”. Then add a state condition to your notification automations to check if this helper is off.
Thanks for the information. I was finally able to get both features working using the boolean helper and the input_datetime helper. The binary_switch was a typo.
The boolean helper was easy to figure out. I added a card to the dashboard to toggle the helper.
The input_datetime helper took some time to figure out. I setup a condition to check if the input_datetime helper was unknown or if now() >= the helper timestamp. If the condition was true, I reset the timestamp with now() + deltatime of 5 minutes.