Add 'Unmonitored Energy' to energy dashboard individual devices

To better understand the usage of energy in the home I have a number of devices with smartplugs. The scale of you usage gets more apparent when there is also an overview of the amount of used energy that is not monitored. I have a manual solution to that (a template sensor which subtracts all the monitored devices from the total consumption). This is very prone to errors as I need to add all new smartplugs manually. I would really like to be able to enable/disable this sensor in the energy dashboard config.

  - platform: template
    sensors:
      unmonitored_energy:
        friendly_name: Unmonitored Energy
        value_template: >
          {{ ((states('sensor.energy_consumption_tarif_1') | float) + (states('sensor.energy_consumption_tarif_2') | float)) -  
            (states('sensor.bijkeuken_wasdroger_energy') | float) -
            (states('sensor.bijkeuken_wasmachine_energy') | float) -
            (states('sensor.smartplug_vriezer_energy') | float) -
            (states('sensor.smartplug_koelkast_energy') | float) -
            (states('sensor.smartplug_vaatwasser_energy') | float) -
            (states('sensor.smartplug_oven_energy') | float) -
            (states('sensor.garage_oplader_bakfiets_energy') | float) -
            (states('sensor.garage_oplader_ebike_energy') | float) -
            (states('sensor.machinekamer_ringleiding_energy') | float) -
            (states('sensor.machinekamer_smartplug_stoomoven_energy') | float) -
            (states('sensor.machinekamer_smartplug_barista_energy') | float) -
            (states('sensor.smartplug_atag_q38s_energy') | float)
          }}
        device_class: energy
        unit_of_measurement: kWh

recorder:
  include:
    entities:
      - sensor.unmonitored_energy

fully support this suggestion and what would make it even better is to include a % of total per item

I use this template to sum all my energy sensors:

{{ states.sensor 
   | selectattr('object_id', 'search', '(_energy)$')
   | rejectattr('state', 'in', ['unavailable', 'unknown'])
   | map(attribute='state') | map('float', none)
   | reject('==', none)
   | sum | round(2) }}

Found here:

@mdehaas An old thread I stumbled on.
Do you use the Riemann Integration for the tracking of energy of the individual plugs?
If so, I tried your suggestion but I get a weird total of unmonitored energy consumption as if I use the current readings of the meter (with the P1-meter) then the total almost matches the total of the meter. :slight_smile:
What am I doing wrong?

Update: O, I guess it should actually work only I can’t add the sensor I created as an individual device in HA. My sensor looks like this:

  - sensor:
      - name: Niet gemonitorde electriciteit
        state: >
          {{ ((states('sensor.totale_stroom_verbruik') | float)) -
            (states('sensor.gemonitorde_electriciteit') | float)
          }}
        device_class: energy
        unit_of_measurement: kWh

And totale_stroom_verbruik is:

   - sensor:
      - name: 'Totale stroom verbruik'
        unit_of_measurement : "kWh"
        state: "{{ (states('sensor.p1_meter_total_power_import_t1') |round(1, default=0)  + states('sensor.p1_meter_total_power_import_t2') | round(1, default=0) - states('sensor.p1_meter_total_power_export_t1') |round(1, default=0)  - states('sensor.p1_meter_total_power_export_t2') | round(1, default=0)) | round(1, default=0)  }} "
        icon: mdi:flash

and monitored electricty is

  - sensor:
      - name: Gemonitorde electriciteit
        state: >
          {{ states.sensor
             | selectattr('object_id', 'match', 'totaalverbruik_plug_')
             | rejectattr('state', 'in', ['unavailable', 'unknown'])
             | map(attribute='state') | map('float', none)
             | reject('==', none)
             | sum | round(2) }}
        unit_of_measurement: kWh
        icon: mdi:flash


Update: after being away for a few hours I decided to give it another try to get the Unmonitored-sensor in the energy-dashboard but couldn’t be chosen. After putting a line state_class: total in the sensor I could add it but although the value increases the bar remains empty.

Another update: a couple of minutes later the bar started to progress.

they now added this in 2024.9 under Individual devices detail usage - but I still think it’d be nice to also have this in the individual devices total usage - as it provides a different uinsight into the scale of the untracked consumption…

2 Likes

I just got this update through 2024.9 and I understand its usefulness. However, I have been using this view to track the usage of a wallbox for mulitple people and in another setup to differentiate total electric vehicle charging into charging from the grid and charging from total.

As you can see, for such an application, also having the remaining total energy usage is not only not helpful, but will render the current functunality useless.

I would therefore advocate to include an option to trigger the function of showing untracked devices on and off.