Statistics sensor, one singe hourly average based on per minute input

I try to calculate the average power consumption per hour, using a DSMR meter throttled to 60s output.

My very initial thought was that a simple statistice sensor would do the job:

``````  - platform: statistics
name: Power Consumed Avg Hr
unique_id: sensor.power_consumed_avg_hr
entity_id: sensor.power_consumed
state_characteristic: mean
max_age:
hours: 1
precision: 2
``````

but of course it was not that simple, the max_age is not for this usage I realize once trying the sensor out. What I want is more of the equivalence of a bar diagram, as in 12-13 as opposed to the line diagram 13 onwards.

Using the HACS integration Average Sensor and the following settings:

``````  - platform: average
name: 'Power Consumed Avg Hr'
unique_id: sensor.power_consumed_avg_hr
start: >-
{{ as_timestamp(
now().replace(
hour=int(now().replace(minute=(now().minute // 60) * 15, second=0).strftime('%H'))-1
).replace(
minute=int(now().replace(minute=(now().minute // 60) * 15, second=0).strftime('%M'))
).replace(
second=0
)
) }}
end: >-
{{ as_timestamp(
now().replace(
hour=int(now().replace(minute=(now().minute // 60) * 15, second=0).strftime('%H'))
).replace(
minute=int(now().replace(minute=(now().minute // 60) * 15, second=0).strftime('%M'))
).replace(
second=0
)
) }}
entities:
- sensor.power_consumed
``````

gives me the type of dataI want, but as a result I’m one hour of

sensor created by Average integration, values from integration does not exacly match Excel averages, but they do the averaging slightly different, and down to the first decimal the align:

Average calculated from source sensor: