Energy Dashboard - Update Interval and Option for Grid Connections

Hello everyone, I would like to discuss the following idea with you.

Increase the update interval and add a sub-consumer option.

Increased frequency of dashboard value updates every 15 minutes (currently only hourly)
Enable the configuration of sub-consumers for network connections to prevent double counting of consumption. In the screenshot, the "Consumption Tibber (HT&NT)" network connection is the meter reading; all other values ​​are actually just consumption meters used to determine individual costs. Therefore, it would be desirable to be able to exclude the other network connections from the total consumption.
This function already exists for devices through the "Upstream Device" option.

Or do you have an alternative idea for how I can implement electricity metering—including cost calculation—without distorting the total consumption?


The Energy Dashboard uses the recorder statistics for the base data.

All energy values come from the long-term statistics, which are captured hourly. The hour value, for state class total-increasing sensors such as energy meters, is just the running sum and final state value for the hour.

As such there is no captured '15 minute' value, and it is not possible therefore to update sub-hourly.

The power 'now' values I believe, as state class measurement, come from the short-term 5 minute averages, and this graph does update every 5 minutes, at least for the 10 day default retention of the data. You will note that, when viewing the power graph for an historical date from more than 10 days ago, the graph resorts to using the long-term hourly figures only, as the short term data has been purged.

The grid energy input and output sensors are expected to be used only for the grid values. Adding other 'device' sensors will double count. At the moment, if you wish to calculate energy and costs for devices, I believe that the expected approach is to add a template sensor, with the daily device energy (resetting utility meter if required) and current energy unit cost used to calculate the day cost.

Naturally for variable rate tariffs, more work is required to capture the hour/half-hour/quarter-hour energy consumption (resetting utility meter) and the current tariff. Clearly easier to (inappropriately) use the grid import to do this for you, but double counting will result.

Add a utility meter, source as the energy sensor, reset 15 minutes.
Add a template sensor, multiply the above by the current energy tariff cost (sensor)
Add a utility meter (reset optional) source above, with the 'source may periodically reset to zero' turned on.

I realise that this is extra work for you, but a lot less work than changing the Recorder long-term statistics and the Energy Dashboard.

I don't think it would be necessary to alter the long-term statistics themselves, but rather just the way the total grid consumption is calculated. If it were possible as is the case with individual devices to specify a sub-option, then it should be feasible to exclude these specific devices from the overall calculation, thereby avoiding double-counting.
In my view, all other alternatives for capturing consumption data including cost tracking and reliable statistics are unfortunately either extremely cumbersome or downright impossible to implement.

Indeed.

Your OP was in two parts.

A change to 15 minute updates is not going to be possible without changing the Recorder, since the Energy Dashboard uses the long-term statistics values, which are only hourly.

Changing the dashboard to accept 'sub-sensors' markers for the grid input energy, so as to offer the existing tariff to cost calculations, but not to add to the total, is possible I guess. You would need to add that to the features request list, or get coding yourself.

Thinking laterally, your problem is that the extra device costs are being added twice, so a workaround would be to subtract them again.

Say you have sensors A, B and C as extra devices, and you create a template sensor D as the negative sum of A, B and C.

Then you can add D to the grid import list, which would add the negative cost of the sum of the extra sensors.

I am not an expert in templates, but the following appears to work. By adding "SubDevice" text into the friendly name of your extra sensors, this finds the sensors and sums their state values.

{{ states.sensor | selectattr('attributes.friendly_name', 'search', 'SubDevice') | map(attribute='state') | map('float', default=0) | sum}}

Needs a bit more work to multiply the result by - 1, but it might just work. Of course the first hour is going to be a very large negative value as this jumps from nothing to the full sum, but workarounds are never perfect.