Hi all,
I have several number item that are linked to electricity meters to measure various consumers. The value is be counted up and can be reseted by a switch.
How to persist this value that I can calculate and visualize it?
Keep the value and don’t reset?
Reset the value regularly to get only the value of a predefined time span? (how to do that?)
I do something similar to Dirk.
Got a power meter counting up.
I use some intermediary items to calculate the difference at midnight to previous day (week, month etc.) which then gives me the daily consumption. This is persisted in another item for visualization.
What would you like to see in a graph/calculated items/…? Make that a statement and work from there: there’s about a million and ten possibiliites to graph or work with power consumption
You are totally right. The number of use-cases will grow and are not clear nie.
Therefore it’s very important to decide for the right persistente strategy to be most flexibel in the future.
Rule #1: define precisely, what you want to achieve
Rule #2: if in doubt - use standard
in your case:
persist the counters (you don’t even specify if it’s S0-Counters or smartmeters - or apples! ) - you can always go in deep and change the outcome from raw data via scripts, if you find you’d like to compare your consumptions on full moon against new moon days?
or use proxy items, you calculate via e.g. rules and persist them
…
everything else is just hoping - and hope is not a strategy!
On the other hand, you only have one data element - the “meter reading”.
Anything else that you can calculate from that today and persist for charting, you could in theory calculate only from persisted data (though it might be more difficult).
So first thing, persist your raw data as “grainy” as you wish. Every minute, perhaps.
Now decide about that rollover factor. How long can your meter/counter go before it rolls over, ten years, or one week? Can you prevent anyone else from resetting the counter?
Work these out to help decide if you have to deal with resets, or if you have to manage it in your methods. Easiest to never reset.