Sum power consumption starting on specific timestamp

Hi all,

Fairly new to Home Assistant (~6 months in) and I’m struggling with this specific case now for a few weeks. I’ve tried, google, I’ve tried my new best friend ChatGPT and I’ve searched this forum but can’t find a fix

The case:
As I started a new contract with an energy supplier, starting November 1st 2022, I want to keep track of my exact power consumption, starting on that date, up until today. (Ideally I want to do the same with my energy production of solar panels as they calculate and invoice this on yearly level)

So I’ve been playing around with templates, with history_stats, with history, but nothing seem to work with sum ánd date ranges. Am I overlooking something?

Ideally I would want something like this to work, but it doesnt, as starttime is not an option for history_stats:

sensor:
   - platform: statistics
    name: "consumed energy since new contract'"
    entity_id: sensor.energy_consumed_sum_total
    state_characteristic: sum
    start_time: '2022-11-01T00:00:00'
    end_time: '{{ now() }}'

Can someone help me out here?

1 Like