Hi Marcus,
As you may have guessed, this is to be achieved by using a persistence service with the help of some rules. First you have to persist (store every changed counter value from your rain gauge in a time series database) and then retrieve the cumulated values for half-day, day, week, etc. with a persistence query, e.g. for the last 12 hours:
<YourStoredItem>.sumSince(now.minusHours(12))
So best is to start reading more about persistence, e.g.:
So the rules are just needed to update your items regularly, because the the math is done by the persistence service and the retrival functions yet. You don’t have to invent the wheel again with some own clever math’s in your rules
And of course: The persistence database serves the charting functions for example in your sitemap for Basic UI.
My hint: Start simple with rrd4j-persistence and the integrated graphing from Basic UI and the mobile apps. When you’re more familiar with it, you may consider InfluxDB as persistence service in combination with Grafana as charting tool. This give your more charting options and prettier graphs.
There is a great tutorial how to make it work:
But as I said, start simple