dreautall / ha-stromnetzgraz

Home Assistant Custom Component for Stromnetz Graz
MIT License
17 stars 1 forks source link

Temporal Resolution of the Meter Consumption #7

Closed mgorfer closed 1 year ago

mgorfer commented 1 year ago

I just want to confirm about the Data retrieved with ha-stromnetzgraz. I have turned on IME prior to installing this custom component.

From the README, I understood that the sensor.meter_... data shows the previous day. The last data points in the plot for August 1st show exactly the value I am seeing in the Web Portal for 01.08 00:00. There are some big jumps in my data, but I have been fiddling around a lot with my server, so maybe I just corrupted some data. image

For the stromnetzgraz:energy_consumption:... I thought that the data would update every 6 hours. In my case, the update also seems to take place every 24 hours. The consumption (according to the Web Portal) should have been 6,86 kWh on the 30th and 5,25 kWh on the 31st. The data in the plot only shows a consumption of less than 0.4 kWh. This is less than the 15-mean peak consumption I was getting on the 31st. `image

So my two questions are, is daily resolution the limit of the current implementation, and is there something wrong with my data?

(Adding of hourly historical energy data seems to be possible https://community.home-assistant.io/t/how-to-import-historical-energy-data-toon-and-others/556356 )

dreautall commented 1 year ago

Hey,

The short summary is that the integration is best used on the energy dashboard, not with the individual sensors.

The long text:

Stromnetz Graz only updates the data every day on midnight (+/- 1-2 hours). 6 hours is the poll interval of the integration, but without new data from Stromnetz Graz, it can't show anything new. So expect new data only once a day, and during the day you'll always see the status from around midnight.

The sensor you're showing in the second picture looks like sensor.meter_consumption_xyz, not stromnetzgraz:energy_consumption:xyz. Those sensors only show the status at the time of polling, so usually the latest "current consumption". With the data being updated in the night, a value of somewhere in between 0 and 0.5kWh seems reasonable - but honestly I wouldn't trust this at all. Might be best to just remove it completely in the future.

stromnetzgraz:energy_consumption:xyz is actually backfilled up to five years (obviously you won't be able to get 15min readings for the time before you enabled IME, the data is just not there), and when added to the energy dashboard, it should show all that data after a day or two. However, I think you can't choose to show this sensor (an "external sensor" with the colons instead of dots) in the History overview, it only really works in the Energy dashboard.

I tried to add the (backfilled) data to an internal sensor (so to sensor.meter_consumption_xyz) at first, but HA is doing some wonky stuff with the internal sensors like adjusting values and averages when you insert "old" data (as it usually expects live values) - and every day is actually "backfilled" at midnight, so it didn't really work out. That's why all the data is in an "external" sensor which HA doesn't touch.

Might be the last part changed in the meantime, when I wrote the integration I saw a couple of posts talking about making HA more fit for "non-live" sensors, but so far I haven't looked deeper into it again.

mgorfer commented 1 year ago

Thank you very much for this detailed explanation! This answers my questions.

I did not know that a sensor called stromnetzgraz:energy_consumption:xyz exist, as it is not listed in the entities for the Stromnetz Graz integration. After re-reading the README, it makes sense to me now! Adding this one to the energy dashboard works perfectly for the plots in the energy dashboard.

It would be really cool, though, to have this sensor available as a real sensor somehow.

Also, to be also able to export it to my InfluxDB and Grafana for further plotting needs.

But for that, I can also easily use the stromnetzgraz API and get my data directly for Grafana. That's maybe an easier setup anyway, as to take the detour through Home-Assistant.