Energy calculation regarding to operating state of heat pump

Hi everyone,
I’m pretty new to Grafana. I’m trying to build a dashboard for an overview of energy consumption in my home. Everything works fine so far, now i want the thing to get a bit advanced.

I’m already calculating the energy throughput of my heat pump via integral of power. Power data is coming from my electricity meter.

Instead of calculating the energy throuput overall i want to calculate the energy throughput of every operating state of the heat pump. Heat pump operating state is also available in data.

Is there any way to do the integral depending on operating state of heat pump?

What i have now:
Energy consumption of heat pump overall.

What i want:
Energy consumption of heat pump for operating state “Heating”
Energy consumption of heat pump for operating state “Cooling”
Energy consumption of heat pump for operating state “Defrost”

How can I handle this topic? Any ideas?

I’m using self hosted Grafana 8.4.5 in cooperation with influxdb 1.8.

Thanks in advance,
Markus

Hi Markus. Could you post a small set of your InfluxDB data? I am hoping that you are storing the state (Heating, Cooling or Defrost) as a tag and then write a query using that tag.