Looking for some advise/help from the community to help solve a problem. With busy days, I sometimes forget to check the mailbox, or forget how long it has been since I last checked.
I want to create a “button” that I can press when I collect the mail. Then, if I don’t press that button again (for a set number of days) I will get an alert indicating it’s time to get the mail.
Any ideas on how I might accomplish this?
I appreciate the help!
If a frontend component will work for you you could create an input_boolean. When you click in in the frontend it will go on. Then you could have an automation that triggers when that goes to on, which then turns it back off and starts a timer. If you click it again before the timer finishes it will restart. If you don’t it will time-out, and you could have another automation that notifies you when that timer times-out. If you want to know how long it’s been since you clicked on it, it’s last_changed attribute would tell you that (and I suppose you could display that somehow, too.)
If that sounds promising, and you’d like a more concrete example, let me know.
I am trying to do something similar to record when we have emptied our cat litter trays ie press the button to record when done and then remind me after so much time when it’s been pressed again.
Not sure if you want a physical button but I have gotten as far as getting an amazon dash button and creating an mqtt binary sensor. The dash button turns the sensor to on. My next step was to create an automation that sets a timer or checks the log and sends a reminder after so many days but I haven’t worked out best way to do it yet.
Would be interested in various ideas from here too
The input Boolean @pnbruckner suggests is also good. A dash button could turn that on too I think. I like the idea of being able to see in the log and history too. Maybe your way of input boolean could prove better??
Thanks for the initial guidance. So far, I was able to set up the input_boolean in the front end. I hit the button and the timer starts counting down towards my target value. Even before I begin to work on the notification end, what do I need to do for the timer to continue after a restart? I do have the recorder enabled in my configuration, directing the data to be stored in mysql (this was to help alleviate some performance issues previously).
Do you mean a HA restart? Hmm, I don’t know what happens to timers across restarts.
Actually, now that I think about it some more, you actually don’t even need a timer. Your second automation (the one that will notify you) can be triggered by the input_boolean being off for the same amount of time. E.g., if you want the notification after, say, two days, you could use a trigger like this:
- alias: Get the mail
I’m not sure, but I believe, if you have the recorder enabled, not only will the state of the input_boolean be restored after a reset, I think that also includes the last_changed attribute, so it’s possible this will work across restarts. If not, you could use the homeassistant start and stop events to take care of that situation I would think.
I have to say I don’t know if the
for: parameter has an upper limit. I guess you could read the code (or I could if you don’t know how), or you could just give it a try.
I’ve taken this in a slightly different direction: I have a magnetic sensor on my mailbox door that indicates that it’s been opened. I use an automation that sets a “check mail” input_boolean when that happens so that when the door closes, I’ll still get the check mail signal. The automation also sends me a text.
The input_boolean is the entity on a button on my Lovelace panel so I get a visual reminder to check the mail as well as an easy way to shut the signal off.