WienerNetzeSmartmeter icon indicating copy to clipboard operation
WienerNetzeSmartmeter copied to clipboard

Calculate Mean Consumption from Hourly data

Open reox opened this issue 2 years ago • 4 comments

Crosspost from https://community.home-assistant.io/t/create-daily-monthly-yearly-reports-for-energy-consumption/476352/2

This is a question related to #20 maybe someone has an idea... I tried to get a mean value for the daily consumption as a UI panel. However, I can not select Mean in the statistic panel. Maybe that is because I do not import the correct data into the statistics table? Do I have to use the mean as well? But what use is a hourly mean when I want the mean consumption per day of, say the last year? Anyone has an idea how this could work? Does it work at all?

reox avatar Dec 27 '22 09:12 reox

Maybe https://community.home-assistant.io/t/total-average-daily-power-consumption/449095 solves this, I have setup an utility_meter now, but it looks like it needs some days to get the values and check if it will show a daily average.

I just fear that it will not work, because the last day is always imported in the night. And using another time for the reset will cause the meter to give averages between these times.... I think that HA is not made to do a lot of these calculations, with values from the past...

edit: the utility meter can possibly not work, because the sensor entity itself has no state, but we store only the statistics data...

reox avatar Dec 27 '22 11:12 reox

Yes, as suspected, the utility meter does not work when the sensor itself has no state. It stays at zero all the time. :/

reox avatar Dec 28 '22 06:12 reox

Hey @reox I have added an utility meter locally to display "daily usage", which pretty much works except when WN reports nothing/0;

image

Utility Meter config:

{ 
    "entry_id": "REDACTED",
    "version": 1,
    "domain": "utility meter",
    "title": "Energy",
    "data": {},
    "options": { 
        "name": "Energy",
        "source": "sensor.REDACTED",
        "cycle": "daily",
        "offset": 0.0,
        "tariffs": [],
        "net_consumption": true,
        "delta_values": false 
}

Today I added a new filter sensor to my configuration.yaml, which should get rid of all 0 values afaik:

sensor:
  - platform: filter
    name: "energy_filtered"
    entity_id: sensor.energy
    filters:
      - filter: lowpass

And with this in place I should be able to set up statistics with correct daily usage data. I will follow up as soon as it fetches new values.

TheRealVira avatar Jan 21 '23 17:01 TheRealVira

@TheRealVira interesting! I tried also the utility meter and did not get it to work. Are you using the statistics branch or main? Maybe the problem is just that it does not work in combination with the statistics...

reox avatar Jan 22 '23 10:01 reox