How to persist power consumption?

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?)

Same here. My power meters are all counting up. I don‘t reset them.
You can work with the persisted data and post it to another item.

I use this code to visualize the consumption until now within 1 week.

postUpdate(Item_per_week, Item_power_total.deltaSince(now.minusWeeks(1)))

Be carefull, most meters have an overflow value. above this value the meter starts from 0

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 :wink:

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! :wink: ) - 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? :wink:
  • or use proxy items, you calculate via e.g. rules and persist them

everything else is just hoping - and hope is not a strategy! :wink:

if you’re unsure, just have a look at the Tutorials & Examples - openHAB Community section or search for Grafana Dashboards - discover and share dashboards for Grafana. | Grafana Labs to get at least a feeling, what others do. then write down your expectation on what you would like to do and work from there.

Absolutely right.

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.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.