Calculating power provided by boiler (using OTGW data)

Hi all,

As part of my quest to map and visualize our energy consumption (reduction always starts with transparency and awareness IMHO), I’ve been building a view on our electricity use using the awesome Sankey chart. Now, I’d like to extend that view adding also our gas consumption.
To do so, I was hoping to use the data from OTGW (using hot water temp, return temp and water flow) to calculate this. Has anyone done this before?

To calculate, I’d start from the basic formula Q = m * c * deltaT. (Q is heat in Joule, m is mass in gram, c is a constant which is 4.18 kJ/(kg*K) and delta T is the temperature difference (in Kelvin or degrees Celsius). This starts from the units that are used in Europe, equivalents exist of course for other regions.
So Q/t is Power (Joule / seconds = Watt) = m/t (flow in g/second) * c * deltaT .

In practice, I’ve set up a sensor to play around with:

  - platform: template
        friendly_name: "Heating Power"
        unit_of_measurement: "W"
        icon_template: mdi:fire-circle
        value_template: >-
          # outgoing temp of boiler from OTGW
          {% set hot_out = states('sensor.dhw_temp_boiler_otgw') | float %}
          # temp of returning water from OTGW
          {% set hot_in = states('sensor.return_water_temp_boiler_otgw') | float %}
          {% set flow_rate = states('sensor.dhw_flow_rate_boiler_otgw') | float %}
          {{ (hot_out - hot_in) * flow_rate * 209/3 | round(1, default=0) }}

(this includes conversion from minutes to seconds etc.)
Based on that, I am considering adding Utility Meters to get to the energy consumption.

Would love to hear how you’re doing this!