Kwh day by day

hi
i 've a sensor displaying the kwh consumption.
My goal is to record at midnight of Monday the total consumption of the day, same for Tuesday, Wednesday, Thursday etc
i see that some counter are available in ha.
Please help me to create that , give me an example
Thx

You could use a triggered template sensor.

template:
  - trigger:
      - platform: time
        at: "23:59:59"
    sensor:
      - name: "Daily Total Energy"
        state: "{{ states('sensor.your_energy_sensor_here') }}"
        unit_of_measurement: "kWh"
1 Like

Hi,

I use this automation to write my energy data to a google sheet at different times so i have another method for analysing my usage. Maybe something like this might help.

Cheers
Nick

alias: "energy: write consumption to google sheets"
description: >-
  write the home energy consumption totals to google sheets. daily, nightly &
  seasonally.
trigger:
  - platform: time
    at: "23:59:59"
    id: midnight
  - platform: sun
    event: sunrise
    id: sunrise
  - platform: sun
    event: sunset
    offset: 0
    id: sunset
  - platform: state
    entity_id:
      - sensor.season
    id: season_change
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: midnight
        sequence:
          - service: google_sheets.append_sheet
            data:
              config_entry: **redacted**
              worksheet: Energy24H
              data:
                status: midnight
                kwh_total: "{{ states('sensor.home_energy_consumption_total')|round(2) }}"
      - conditions:
          - condition: trigger
            id: sunrise
        sequence:
          - service: google_sheets.append_sheet
            data:
              config_entry: **redacted**
              worksheet: EnergyNightly
              data:
                status: sunrise
                kwh_total: "{{ states('sensor.home_energy_consumption_total')|round(2) }}"
      - conditions:
          - condition: trigger
            id: sunset
        sequence:
          - service: google_sheets.append_sheet
            data:
              config_entry: **redacted**
              worksheet: EnergyNightly
              data:
                status: sunset
                kwh_total: "{{ states('sensor.home_energy_consumption_total')|round(2) }}"
      - conditions:
          - condition: trigger
            id: season_change
        sequence:
          - service: google_sheets.append_sheet
            data:
              config_entry: **redacted**
              worksheet: EnergySeasonally
              data:
                status: "{{ states('sensor.season') }}"
                kwh_total: "{{ states('sensor.home_energy_consumption_total')|round(2) }}"
mode: single

1 Like