An approach to both detailed and group level energy management

@cliffkujala Here is a link to my esphome yaml for my vue in panel 1. https://gist.github.com/flaviut/93a1212c7b165c7674693a45ad52c512?permalink_comment_id=4058452#gistcomment-4058452
Panel 2 is exactly the same except the circuit names / configs where I use “p2” in the naming instead of “p1”. My setup is obviously a little different than yours, but if I were you, here is how I would handle it:

  • Main Panel Vue1 - Configure to monitor total power coming into your home as well as 16 circuits. In your esphome configuration, be sure calculate the “Balance Power” which is essentially the power used by all circuits not individually monitored with this device. This is important because in home assistant you will use this “Balance Power” figure to subtract out the circuits monitored with your Vue2 and Vue3 devices.
  • Main Panel Vue2 - Maybe you’ve already thought of a better way, but it seems to me you would still need to configure this to monitor the same primary feed coming into the panel. In this case you would likely disregard the total power monitored with this device since it will be the about the same as what you already know from Vue1. You would then have the monitoring for 16 more circuits which, as stated above, need to be subtracted from your balance power of Vue1.
  • Sub Panel Vue3 - Even though this is fed from the main panel, I’m assuming you only monitor the total power of this sub panel from the Vue3. (i.e. no CT’s on this feed in your main panel) In this case, you will have the total power monitored in this sub panel, as well as 16 circuits. There are a few options here, but the easiest is just to subtract the Vue3 total panel from your balance power of Vue1. (alternatively, you could subtract out all of your individual Vue3 circuits and the Vue3 balance from that Vue1 balance, but I don’t think it buys you anything)

The method I was describing above should ensure that the power figures of your individual circuits are all tying out to the total power delivered to your home. The specific naming you use for your entities just needs to be consistent and unique so your are able to easily build your groups for the calculations. (i.e. putting all of your Vue2 circuits into a group which you will then use to add the value of the state of each member so you can subtract from the Vue1 Balance Power.) You might use something as simple as v1_01 - v1_16, v2_01 - v2_16, v3_01 - v3_16.

Hope that helps

@mboarman I think in the future there will be some way to access the long term statistics that hold these values when you look at the energy dashboard, but from what I can tell there aren’t any good programatic ways to get them now. In the meantime, I would probably write an automation with a trigger in the last few minutes of the month to capture the value into an input_number before the reset. Alternatively, you could probably put an automation in with a trigger on “sensor.electric_home_monthly_total_energy” that would trigger when the reset occurs and capture that prior value which would have been your monthly total.

Amazing work and skill, wow
Im brand new to HA, been using emporia for a year.
maybe you can answer a question for me
I am also using the magico13 method, the HA energy dashboard does not seem to see any of the 1 minute sensors. I know they are avbl as I can use them on my own dashboard.
right now all Im trying to do is make a card like the HA energy device card where it can show all the circuits, but I want to use the 1 minute sensors not the 1 day or month sensors
any idea what the issue is ?

anyone knows why this does not count correct?

- name: power_g_light_total
  icon: mdi:lightbulb-group
  state: >-
    {% set virtualpower = expand('group.power_g_light_total') | rejectattr('state', 'in', ['unavailable', 'unknown']) | map(attribute='state') | map('float') | sum | round(2) %}
    {{ max( virtualpower | round(1), 0.0 ) }}
  attributes:
    tmp_friendly_name: "Light Group Total Power"
    <<: *power_sensor_force_update
  <<: *power_sensor_defaults

- name: power_g_hvac_total
  icon: mdi:lightbulb-group
  state: >-
    {% set virtualpower = expand('group.power_g_hvac_total') | rejectattr('state', 'in', ['unavailable', 'unknown']) | map(attribute='state') | map('float') | sum | round(2) %}
    {{ max( virtualpower | round(1), 0.0 ) }}
  attributes:
    tmp_friendly_name: "Light Group Total Power"
    <<: *power_sensor_force_update
  <<: *power_sensor_defaults

- name: power_g_hvac_total_cost
  attributes:
    tmp_friendly_name: "Light Group Total Cost"
  state: "{{ max( states('sensor.power_g_hvac_total') | float / 1000 * states('sensor.nordpool_kwh_krsand_nok_3_095_025') | float, 0.0) }}"
  <<: &cost_sensor_defaults
    unit_of_measurement: "NOK"
    state_class: measurement

- name: power_g_light_total_cost
  attributes:
    tmp_friendly_name: "Light Group Total Cost"
  state: "{{ max( states('sensor.power_g_light_total') | float / 1000 * states('sensor.nordpool_kwh_krsand_nok_3_095_025') | float, 0.0) }}"
  <<: *cost_sensor_defaults

@ccpk1
I recently installed an Emporia Vue (using ESPHome) and stumbled on this approach; I really like it.

A few questions:

  1. Are you still using this approach? Any changes or improvements?
  2. You use a template to abstract every power entity into a “virtual” sensor, regardless if it comes from Vue, a smart plug, smart switch, etc?
  3. You only store data (via recorder) for the “virtual” entities?
  4. Did you post your Influx/Grafana details somewhere?
  1. Yes still using this approach, it’s been very reliable.
  2. That is correct. It was more work up front, but I wasn’t able to figure out another way to have the control required to manage this cleanly otherwise. i.e. What do you want to happen when you add any new device with a power entity
  3. That is correct. With that many entities and constant value changes, it can have a performance impact otherwise. Also note it’s important to use trigger templates as stated in the post, otherwise you will likely have performance issues.
  4. I don’t think I did. I don’t use it very often, so I’ve somewhat forgot many of the details. If someone knows a simple way to extract the configuration from those and show it, let me know.

How do you determine the defrost cycles? Is there some trigger or specific power profile that you use to know it’s in defrost?

Once I had the energy monitoring going on the devices, I was able to look at the history to see different power usage levels. Then I just monitored the units for a day or two to make sure I was matching them up with with what was happening on the unit. (Typically you can see a little icing on the coils as the defrost starts)

For anyone looking for an easy way to auto switch the peak/offpeak I am using this automation

alias: Energy Tariff
description: ""
trigger:
  - platform: homeassistant
    event: start
  - platform: state
    entity_id: sensor.current_electricity_rate_type
    not_to:
      - unavailable
      - unknown
action:
  - action: select.select_option
    target:
      entity_id:
        - select.daily_energy
        - select.monthly_energy
    data:
      option: "{{ states('sensor.current_electricity_rate_type') }}"
mode: single

The sensor.current_electricity_rate_type is configured as:

current_electricity_rate_type:
        friendly_name: Current Electricity Rate Type  
        value_template: >-
          {% set season = 'summer' if is_state('sensor.current_electricity_season', 'summer') else 'winter' %}
          {% set type = 'peak' if today_at('14:00:00') <= now() < today_at('18:59:59') else 'offpeak' %}
          {{ season~'_'~type }}

Then you can follow what @guardmedia has described in his post above for cost calculations and energy usage by season/tariff/daily/weekly/monthly