Creating sensors for energy consumption for last 7 days

Hi, I have sonoff smart plug which count total energy in absolute value in kWh. What I want is, create multiple sensors for last 7 days which take last max value from that day. What came to mind is create utility meter with daily cycle and then statistic sensor with max value. But now I need complete it, where I probably need create my 7 sensors which they will take data from statistic sensor that take data from utility meter but from specific date. Can you help me with this. Thank you.

utility_meter:
  energy:
    source: sensor.plug_computer_energy_total
    name: Computer - Total energy per hour
    unique_id: sensor.um_computer_total_energy_per_hour
    cycle: hourly
    offset: 0
    delta_values: false
    net_consumption: false

sensor:
  - platform: statistics
    entity_id: sensor.computer_total_energy_per_hour
    name: Computer - Max energy value per hour
    unique_id: sensor.stat_computer_max_energy_value_per_hour
    state_characteristic: value_max
    sampling_size: 1
    precision: 3

Why do you want to create the seven daily sensors?

If it is only to graph them you don’t need to. Just create one daily utility meter:

utility_meter:
  energy:
    source: sensor.plug_computer_energy_total
    name: Computer - Daily energy
    unique_id: sensor.um_computer_daily_energy
    cycle: daily
    offset: 0

You can then graph this with Apex Charts, here’s an example

type: custom:apexcharts-card
apex_config:
  chart:
    height: 140%
  dataLabels:
    background:
      enabled: false
    style:
      colors:
        - var(--primary-text-color)
graph_span: 1w
span:
  end: day
header:
  show: true
  title: Daily Energy (Offpeak)
experimental:
  color_threshold: true
yaxis:
  - id: left
    min: ~0
    apex_config:
      forceNiceScale: true
series:
  - entity: sensor.energy_hot_water_daily_offpeak
    type: column
    yaxis_id: left
    float_precision: 2
    show:
      datalabels: true
    group_by:
      func: last
      duration: 1d
    color_threshold:
      - color: '#e45e65'
        value: 3.5
      - color: '#e0b400'
        value: 3
      - color: '#0da035'
        value: 2.5
      - color: '#039BE5'
        value: 0

Screenshot 2022-10-09 at 09-55-54 Overview – Home Assistant

Hi Tom,
thank you for your answer. I definitely later create apex chart, thank you for this, but I want also too have these sensors, because I want later add to my button card template.
energy

have you solve this tipoc? i’m interested too…