Hi
If you are like me, it is quite common to forget when to change smoke alarm battery(10 year), clean the condenser on the dryer(yupp every 6 month), filter on the hvac (every 1 year), clean filter on vacuum cleaner(every 3 months) and so on.
Is there a way to integrate these reminder and reset them in OH when you have done it? Was thinking of cron rules, switches, email notifications and persitance. But maybe there is a better way?
A rule that creates a timer (for the reminder interval) when the switch changes to OFF
When the rule expires, set the switch to ON
A rule that sends a notification (email, or whatever) when the switch changes to ON
Then when you have done then necessary maintenance (e.g. replaced the filter) you acknowledge the repair by manually flipping the switch (to OFF) and the whole process repeats.
Hmm… I missed that point. Unfortunately persistence is not going to help with running timers, meaning that the proposed solution will only work as long as your system is running continously. Back to the drawing board…
Given that the maintenance interval is rather large (months, or even years?), it is probably more than good enough to check once a day if it is time to do maintenance.
So, my revised proposal would be something like this:
Create a number item (that is initialized to the number of days until maintenance) and a switch item (that is initalized to OFF) for each reminder.
Create a rule that fires once a day (based on a cron trigger).
In the rule count down all of your number items and check if they reach zero. If zero, then set the switch to ON.
Then a rule like above that triggers on switch ON and sends notification.
And a rule that triggers on switch OFF (acknowlegde maintenance done) and resets the number (counter) to the value of the reminder interval.
With this approach you can add persistence and thus keep your reminders running across reboots of your system.
Could you use the GCal binding (https://github.com/openhab/openhab/wiki/GCal-Binding) and add your reminders into there. Almost certainly far easier (and tbh you could just use the calendar for these reminders )
Maybe it is beside the point, but why do you need/want to “read the calendar item 1 year ahead”?
I guess your calendar entry would be a “recurring event”, right? Obviously you will not have any feedback to the calendar to indicate when you did the service/maintenance so your next service interval would not be able to take that into account.
Given that the service intervals are quite long (months to year), however, and assuming that you are “obeying the sevice notice within reasonable time”, this should not matter, or?
In most cases yes, but for the dryer the service interval is 3 month. So if
you live in Norway and have 4 weeks of summer holiday, it would be nice to
shift the recurrent event by 4 weeks.