Open allygator opened 4 years ago
If we approach this we're getting into hosted DB territory which would be over our budget of "however much electricity the Pi consumes"
We could host a database on the pi, online options could also include firebase maybe?
SQLite is usually pretty easy to configure for local storage. It could track four things:
Finding overdue and incomplete reminders is then a simple SQL query where Z >= NOW && !Complete
For normal operation, we set a timer for every incomplete reminder, send a ping when the timer wakes up, and mark the reminder as complete in the DB. Alternatively, we can use a timer on a fixed interval (e.g. 1 minute) that scans for incomplete, overdue reminders and sends at that time. You might get some inorganic batching this way if there are multiple reminders within the same interval (but were actually seconds apart in real life).
For times that become overdue when fred is down, we don't need hosting if late reminders are acceptable. On startup, fred can check for all that have not been reminded and are overdue and ping with a polite "Whoops! Bots need vacations too. Here's your [reminder]."
This might not be possible with the current setup, but support for "fred remind X to Y in Z (time unit)" has been requested.