#Integrate a graph

1 messages · Page 1 of 1 (latest)

crystal crest
#

I am trying to figure out weather I can fully load a battery I am looking forward to buy or not. Therefore I want to integrate over my power usage graph.
To be precise I want to integrate between to timestamps (today 5 am and tomorrow 5 am) everyday a new calculation and also i want to integrate the graph for everything below 0 Watt and over 1000 Watt (maximum charging power)

Any idea on how to accomplish this easily?
Thanks

ionic trellis
#

I would use an integral helper.
If you want it daily, then feed that through a utility_meter w/ daily reset.

#

You'll also want to first clamp the input with a template sensor.

crystal crest
#

I dont exactly want a daily measurement rather from 5 am until 5 am like described above.

#

So it is daily but with an offset of 5 hours.

clear fable
#

A utility meter has an offset option (for hours) if you use yaml. Other option would be to just make an automation to call utility_meter.reset at 5 AM.

But for this task I would also look at the Battery Sim integration.

crystal crest
#

The battery sim looks interessting. Just installed Hacs. Now I am trying to configure the Sim.
It requires 2 sensors for in- and output of the grid.
I only have one sensor which outputs a negative value if electricity is given to the grid and positive if coming from the grid. Any idea how I can split this into 2 sensors?

clear fable
#

You can make two template sensors based on that entity. Something like:

{% set s = states('sensor.your_sensor') -%}
{% if not s|is_number -%}
  none
{% elif s|float > 0 -%}
  {{ s |float |abs }}
{% else -%}
  0
{% endif -%}

And of course <0 for the export

crystal crest
#

Nevermind. The Sim doenst actually need current Power readings as I thought. It needs the Energy (kWh) from and into the grid which I read seperatly.