Hello everyone,
I have a templated sensor that subtracts my solar production from my consumption to get my net grid consumption.
{% set consumption = states('sensor.total_power_total_power_power') | float %}
{% set production = states('sensor.shelly_em_channel_1_power') | float %}
{{[ (consumption - production) | round(1), 0 ] | max }}
Then I have a simple Riemann sum to get the energy consumption from the grid using the trapezoidal method.
Today it was a sunny day and my grid consumption has been 0 for most afternoon, save for a 2kw peak when I used the water boiler for 1 minute. Apparently that was worth a whole kwh of energy.
I know that trapezoidal sum is not the best at handling peaks, but this is grossly overestimated.
Am I doing something wrong?