Hey, i have a hard time figuring out how to use history_stats for my kwh energy usage.
My smart plugs report current watt usage and all-time kwh usage, i created a helper that combines the all-time kwh usage of 3 smart plugs into one entity.
With this combined kwh entity i create utility_meters for today, current month and current year. No problem so far.
The problem is with history_stats, as you can see in the title i want yesterdays, last months and last years energy usage in kwh, i tried creating something like this:
- platform: history_stats
name: aquarium_rack_power_usage_kwh_yesterday
entity_id: sensor.combined_kwh_aquarium_rack
state: '???'
type: time
start: '{{ now().replace(hour=0, minute=0, second=0) - timedelta(days=1) }}'
end: '{{ now().replace(hour=0, minute=0, second=0) }}'
As the state of sensor.combined_kwh_aquarium_rack is the kwh number that is always increasing i do not know what to put in the history_stats state variable…