Monitoring remaining energy usage

  1. Above is an extract from my HA, I have a total energy monitor at mains.
  2. I also have several smart switches for some devices, e.g. fridge, washing machine and PC
  3. This is because I assume the other appliances are using minimal power compared to the “heavy” ones
  4. I would like to know how much power these “other” appliances are using, in case someone connects something new/etc and it spikes up
  5. Has anyone done something similar?

Yes, yes, big time.

I use a combination of these two statistics sensors:

sensor:
  - platform: statistics
    name: "Maximum dishwasher energy"
    unique_id: maximum_dishwasher_energy
    entity_id: sensor.dishwasher_today_s_consumption
    state_characteristic: value_max
    max_age:
      hours: 24

  - platform: statistics
    name: "Mean maximum dishwasher energy"
    unique_id: mean_maximum_dishwasher_energy
    entity_id: sensor.maximum_dishwasher_energy
    state_characteristic: mean
    max_age:
      days: 60

wow looks cool, but first glance I don’t understand any bit of it. Let me take a closer look.

The way I did it is by creating a sensor that simply takes energy consumption at meter and then substract the energy used by the individual appliances from that. Based on that percentage I started hunting for other energy consumers and either removing them from mains or started measuring them.

At this moment in time I measure about 90% of all my energy consumption. See charts below:

Absolutely. I also have a whole bunch of usage remaining templates that calculate the average use vs the current use:

  - unique_id: tv_usage_remaining
    attributes:
      icon: mdi:television
      friendly_name: TV usage remaining
      unit_of_measurement: "kWh"
      device_class: energy
    state: >
      {% set sunup = is_state('sun.sun','above_horizon') %} 
      {% set average = states('sensor.mean_maximum_tv_s_energy')|float(16)  %}
      {% set passed_min = now().strftime('%H')|float * 60 + now().strftime('%M')|float  %}
      {% if sunup %}
      {% set time = states('sensor.template_till_solar_end')|float(0)|abs +15 %}
      {%else%}
      {% set time = 1440 - passed_min %}{%endif%}
      {% set power = states('sensor.tv_s_power_powersensor')|float(3) %}
      {% set instant = ((power/ (60/time)) / 1000) |round(3) %} 
      {% set av_rem = ((average/ (60/time)) / 1000) |round(3) %}
      {% if  is_state('input_boolean.show_average_usage', 'on') %}
      {{[average,0]|max}}
      {%else%}
      {{[instant,0]|max}}
      {% endif %}

These will either show an average remaining kwh value or calculate the expected kwh for the rest of the day based on the current power use.

I’m sorry if I’m doing something thats not allowed (as in, bring back a relatively old thread back to live), but I’m trying to do exactly the same thing you did.

I got a ton of Shelly plugs measuring all sorts of devices in my home.
However, I want to know what “other” usage I have besides what those Shelly plugs measure by simply substracting their usage from the total use at the meter and make an entity/sensor with the name “overig” (remaining).

Does anyone know how I do this? I’ve tried looking for template codes that do this, but some are really specific and I just need to substract some sensor/entity id’s from the ‘at the meter’ entity.

It can be done easily by creating a template sensor. Best thing is to do this in the “Developer tools” “Template” section and copying it to configuration.yaml when you are satisfied.

The coding might seem hard at first, but it you will get used to it quickly.

Just follow the below logic:

{{ (states(‘sensor.sensor1’)|float - states(‘sensor.sensor2’)|float - states(‘sensor.sensor3’)|float }}

Hi fversteegen,
Thank you for the reply. My apologies for my late reply.
Yes this is exactly what we had to figure out.
me and a friend went through it and it works!
Took a bit of time to get all the sensors in there and add/substract the correct ones.

If anyone else stumbles upon this thread and needs help, this is the code we used:

% set
  knowndevices_energy =
states('sensor.shellyplug_s_uniqueid_energy') | float +
states('sensor.shellyplug_uniqueid_energy') | float +
states('sensor.shellyplusplugs_uniqueid_switch_0_energy') | float +
states('sensor.shellyplusplugs_uniqueid_switch_0_energy') | float +
states('sensor.shellyplusplugs_uniqueid_switch_0_energy') | float +
states('sensor.shellyplug_uniqueid_energy') | float
%}
{#
- shellyplug_s_uniqueid_energy = Vloerverwarming
- shellyplug_uniqueid_energy = Quooker
- shellyplusplugs_uniqueid_switch_0_energy = TV/Soundbar/Switch
- shellyplusplugs_uniqueid_switch_0_energy = Serverkast
- sensor.shellyplusplugs_uniqueid_switch_0_energy = Bureau
- sensor.shellyplug_uniqueid_energy = Wasmachine/Droger/Vriezer
#}
{% set
  solarcorrected_energy =
states('sensor.uniqueid_total_energieopbrengst_levenslang') | float -
states('sensor.p1_meter_energy_export') | float
%}
{% set
  imported_energy =
states('sensor.p1_meter_energy_import') | float
%}
{% set
  all_consumption =
solarcorrected_energy + imported_energy
%}
{{ all_consumption - knowndevices_energy }}

“uniqueid” has been used as a placeholder for any ‘sensitive’ information that I´d rather not share in public forums