How to use a total_energy sensor together with all the separate ones?

I have some 20 devices measuring energy/power, listed separately in the Energy Dashboard. I also have a pulse meter reporting my total_energy consumption (kWh). How can I get a sensor that counts the remainder: total_energy - sum(all individual energy meters)? That would include all other devices - not currently measured separately. The pulse meter is a esphome device and reports both power and daily_total. I would like to have the result in the format the Energy Dashboard likes.

Or is there some other smart way to use total_energy without summing it with everything else but having all other meters included in the total?

I have a sensor which adds up the power recorded by all my devices (in watts), then feeds it through the Riemann sum integration to give energy in kWh.

# Energy total =================================================================

  - platform: template
    sensors:
      total_power:
        friendly_name: total power
        unit_of_measurement: Watt
        value_template: >
          {{ states('sensor.boiler_power')| float(0) + states('sensor.speakers_power')| float(0) + states('sensor.network_power')| float(0) + etc etc }}

  - platform: integration
    source: sensor.total_power
    name: total
    unit_prefix: k
    round: 5

Could you subtract that from the total provided by the pulse meter? Can’t try it myself unfortunately because I depend on daily manual readings

Yes something like that seems like a solution. One problem I have with that is that at least one of my devices doesn’t give power readings, only accumulated energy usage in 0.1kWh increments. It’s impossible to derive power readings from that - it might be 2kW off for 20 hours.

I might have to go the energy route. Make a utility_meter for every single device, sum up their readings, then subtract that from the total. Seems really convoluted, and I wish there was a simpler way to do this. The Energy dashboard already has all the data I need (per hour, per day, etc readings), but I can’t find a way to access it.

Have you found a solution?

No, I just accepted that this has to wait. To get sensible values for the remainder, there would have to be equivalent utility_meters for every device: minute/hour/day. Devices updating in a non-synchronized manner would result in silly values, like negatives and weird jitter. It would thus result in too many intermediate templates/sensors to remember when adding/removing devices.
I also found more interesting problems, like how to automatically optimize and balance the usage of ventilation and heat pump - depending on the conditions inside and outside.